import datetime
days = int(input())
d0 = datetime.date(1970,1,1)
d1 = d0 + datetime.timedelta(days=days)
print(d1.year)
print(d1.month)
print(d1.day)
